<?php

namespace app\adminapi\controller;

use think\Controller;

class Upload extends BaseApi
{
    public function logo(){
            $type = input('type');
            if(empty($type)){
                $this->fail('缺少参数type');
            }
            $file = request()->file('logo');
            if(empty($file)){
                $this->fail('缺少上传文件');
            }
          $info = $file->validate(['size'=>1024*1024,'ext'=>'jpg,png,gif'])->move(ROOT_PATH . 'public' . DS . 'uploads' . DS .$type);
          if($info){
            $logo = DS . 'uploads' . DS . $type . DS . $info->getSaveName();
            $this->ok($logo);
          }else{
            $this->fail($file->getError());
          }
        
    }
    //多图上传
    public function images(){
        $type = input('type');
        if(empty($type)){
            $this->fail('缺少参数type');
        }
        $files = request()->file('images');
        if(empty($files)){
            $this->fail('缺少上传文件');
        }
        $images = [];
        foreach($files as $file){
}
